<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//游戏类
			function Play(name, level) {
				this.name = name;
				this.level = level;
			}

			function F() {} //空函数(类)
			F.prototype = Play.prototype; //Play原型挂在空函数原型上
			//人物类
			function Human(name, level, sex) {
				Play.call(this, name, level)
				this.sex = sex;
			}
			Human.prototype = new F(); //子类的原型设为空函数的实例
			Human.prototype.constructor = Human;//修复构造函数
			var human1 = new Human("李逍遥", 1, "男");
			console.log(human1);

			//怪物类
			function Creep(name, level, exp) {
				Play.call(this,name, level);
				this.exp = exp; // 击杀给玩家多少经验
			}
			Creep.prototype = new F();
			Creep.prototype.constructor = Creep;
			var creep1 = new Creep("豌豆射手", 1, 50);
			console.log(creep1);
			
			//道具类
			function Item(name, level, type) {
			    Play.call(this,name, level);
			    this.type = type; // 1 恢复类; 2 攻击类; 3 强化类
			}
			Item.prototype = new F();
			Item.prototype.constructor = Item;
			var item1 = new Item("吸血书", 1, "恢复类");
			console.log(item1);
		</script>
	</body>
</html>
